﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using YiYiTong.Rocket.Helper;

namespace YiYiTong.Rocket.Model.ParamModel
{
    public class BaseQueryModel : BaseParamModel
    {
        public int pageIndex { get; set; } = 1;
        private int pSize = 0;
        public int pageSize
        {
            get
            {
                if (pSize == 0)
                {
                    string ps = Utils.GetCookie("pagesize");
                    pSize = ConvertHelper.TryPraseInt(ps, 20);
                }
                if (pSize == 0)
                {
                    pSize = 20;
                    Utils.SetCookie("pagesize", pSize.ToString(), "/", "", DateTime.Now.AddDays(1));
                }
                return pSize;
            }
            set
            {
                pSize = value;
                Utils.SetCookie("pagesize", pSize.ToString(), "/", "", DateTime.Now.AddDays(1));
            }
        }
    }
}